#ifndef __DONGLE_UTIL_H__
#define __DONGLE_UTIL_H__

#define SMALLEST_ACM_DEVICE_INDEX 6
#define MAX_MATCHED_CANDIDATE 20

/***********************zte dm cmd set*************************************/
#define ZTE_DM_BUFFER_SIZE 1024
static char zte_dm_buffer[ZTE_DM_BUFFER_SIZE] = {'\0'};
static char dm_esn_cmd[5]  ={0x01,0xF1,0xE1,0x7E,'\0'}; 
// cmd len = 4;
//rsp: 0x01,0,0,0,0,33,c4,7e; cmd+esn+crc+7e, len=8
static char dm_status_cmd[8] ={0x4B,0x65,0x00,0x00,0x8C,0x16,0x7E,'\0'};
// cmd len = 7;
//rsp:4B 65 00 00   01 00 00 01 00 00 00 00 00 00    42 F0 7E; len = 17;
/************************************************************************/

int modem_info_fix_port_index(struct modem_info* info, int at);
const char* modem_info_get_device_prefix(struct modem_info* info);
void modem_info_get_port_path(struct modem_info* info, int at, char* path);
int modem_info_is_dm_modem(struct modem_info* info);
void modem_info_dump(struct modem_info* info);
int modem_usb_get_all_devices(char device[][MAX_PATH_LEN], int* count);
int dm_writeline_len(int fd, const char *s, unsigned int length);
int dm_read_timeout(int fd, void *buf, unsigned int nbytes, unsigned int timeout);
void dm_dongle_initial();
int check_is_dm_dongle_by_modem_info(struct modem_info* info);
int check_is_dm_dongle_by_path(int pid_vid, const char* at_port);
void initial_sleep_by_pid_vid(unsigned int pid_vid);

#endif
